package Demo10;

import java.util.ArrayList;

public class xueshengtest {

    public static void main(String[] args) {
        ArrayList<xuesheng> list = new ArrayList<>();
        list.add(new xuesheng("张三",1));
        list.add(new xuesheng("李四",2));
        list.add(new xuesheng("王五",3));

        for (int i = 0; i < list.size(); i++) {
            xuesheng x = list.get(i);
            if (x.getName().equals("张三")){
                x.setName("张桐");
            }
            if (x.getName().equals("王五")){
                list.remove(x);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}
